package com.mzj.saas.mservice.house.controller;

import com.mzj.saas.commons.ResultBean;
import com.mzj.saas.mservice.house.service.CheckService;
import com.mzj.saas.mservice.house.vo.CheckVO;
import com.mzj.saas.mservice.sys.entity.AppUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * 资格核查接口
 */
@Controller
@RequestMapping("/check")
public class CheckController {

    @Autowired
    private CheckService checkService;

    /**
     * 查询承租人
     *
     * @param houseId
     * @return
     */
    @GetMapping("/findMatchUser")
    @ResponseBody
    public ResultBean<List<AppUser>> findMatchUser(@RequestHeader String accessToken,
                                                   @RequestParam(value = "houseId") String houseId) {
        return checkService.findMatchUser(accessToken, houseId);
    }

    /**
     * 查询资格核查列表
     *
     * @param houseId
     * @return
     */
    @GetMapping("/checkList")
    @ResponseBody
    public ResultBean<List<CheckVO>> checkList(@RequestParam(value = "houseId") String houseId) {
        return checkService.checkList(houseId);
    }

    /**
     * 资格核查详情
     *
     * @param id
     * @return
     */
    @GetMapping("/findCheck")
    @ResponseBody
    public ResultBean<Map<String, Object>> findCheck(@RequestParam(required = false) Long id) {
        return checkService.findCheck(id);
    }

    /**
     * 新增资格核查
     *
     * @param vo
     * @return
     */
    @PostMapping("/saveCheck")
    @ResponseBody
    public ResultBean<Object> saveCheck(@RequestHeader String accessToken, CheckVO vo
                                        //@RequestParam(value = "uploadFile") MultipartFile[] files
    ) {
        return checkService.saveCheck(accessToken, vo);
    }

}
